package com.zlpc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zlpc.pojo.Information;
import com.zlpc.service.SearchService;

@Controller
public class SearchController {

	@Autowired
	private SearchService searchService;


	// 1 搜索索引数据
	@RequestMapping("query/{keyWord}")
	@ResponseBody
	public Information query(@PathVariable String keyWord) throws Exception {
		//System.out.println("keyWord="+keyWord);
		Information information = searchService.query(keyWord);
		return information;
	}
	
	
	// 2 查询数量
	@RequestMapping("list")
	@ResponseBody
	public String list() throws Exception {
		//Long count = searchService.list(keyWord);
		System.out.println("list()");
		String test = "{\"java\":\"15000\",\"ui\":\"5000\"}";
		return test;
	}
	
	
	/*// 3 homepage缺失网页跳转
	@RequestMapping("homepage/erro")
	public String homepageEero() throws Exception {
		return "homepageEero";
	}*/
	
	

}

























